package com.mark.vo;

import com.mark.pojo.Category;
import com.mark.util.DateTimeUtil;
import com.mark.util.PropertiesUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * Created by Choisaaaa on 2018/5/10.
 * 商品种类Vo设计类
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CategoryVo {
    private Integer id;
    private Integer shopId;
    private Integer parentId;
    private String productCategoryName;
    private Boolean enableStatus;
    private String imageAddress;
    private String createTime;
    private String lastEditTime;
    private String imageHost;

    public CategoryVo assembleCategoryVo(Category category){
        CategoryVo categoryVo = new CategoryVo();
        categoryVo.setId(category.getId());
        categoryVo.setShopId(category.getShopId());
        categoryVo.setParentId(category.getParentId());
        categoryVo.setProductCategoryName(category.getProductCategoryName());
        categoryVo.setEnableStatus(category.getEnableStatus());
        categoryVo.setImageAddress(category.getImageAddress());
        categoryVo.setCreateTime(DateTimeUtil.dateToStr(category.getCreateTime()));
        categoryVo.setLastEditTime(DateTimeUtil.dateToStr(category.getLastEditTime()));
        categoryVo.setImageHost(PropertiesUtil.getProperty("ftp.server.http.prefix",PropertiesUtil.FTP_SERVER_HTTP_PREFIX));
        return categoryVo;
    }
}
